﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsServerSolutions.Common.UI;
using Microsoft.WindowsServerSolutions.Wizards;

namespace TV4Home.Server.Vail.AddIn.Wizards.InstallTVServer
{
    public partial class WPDatabaseTypeControl : WizardPage
    {
        public WPDatabaseTypeControl()
        {
            InitializeComponent();
        }

        public enum DatabaseType
        {
            MSSQL,
            MySQL,
            SQLAlreadyPresent
        }

        public event EventHandler DatabaseTypeButtonClicked;

        public DatabaseType SelectedDatabaseType
        {
            get;
            private set;
        }

        private void InvokeDatabaseTypeButtonClicked()
        {
            if (DatabaseTypeButtonClicked != null)
                DatabaseTypeButtonClicked.Invoke(this, EventArgs.Empty);
        }

        private void DatabaseTypeButton_Click(object sender, EventArgs e)
        {
            if (sender == rbMSSQL)
                this.SelectedDatabaseType = DatabaseType.MSSQL;
            else if (sender == rbMySQL)
                this.SelectedDatabaseType = DatabaseType.MySQL;
            else
                this.SelectedDatabaseType = DatabaseType.SQLAlreadyPresent;

            InvokeDatabaseTypeButtonClicked();
        }
    }
}
